//##########################################################################
//#                                                                        #
//#                       CLOUDCOMPARE PLUGIN: qDummy                      #
//#                                                                        #
//#  This program is free software; you can redistribute it and/or modify  #
//#  it under the terms of the GNU General Public License as published by  #
//#  the Free Software Foundation; version 2 of the License.               #
//#                                                                        #
//#  This program is distributed in the hope that it will be useful,       #
//#  but WITHOUT ANY WARRANTY; without even the implied warranty of        #
//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
//#  GNU General Public License for more details.                          #
//#                                                                        #
//#               COPYRIGHT: XXX                                           #
//#                                                                        #
//##########################################################################
//
//*********************** Last revision of this file ***********************
//$Author:: dgm                                                            $
//$Rev:: 1811                                                              $
//$LastChangedDate:: 2011-02-21 17:37:07 +0100 (Mo, 21 Feb 2011)           $
//**************************************************************************
//

#ifndef Q_MY_PLUGIN_HEADER
#define Q_MY_PLUGIN_HEADER


#include <QObject>

#include <ccPointCloud.h>

#include "city.h"
#include "Container.h"

#include "../ccStdPluginInterface.h"

class BuildingReconstructor;
class QListWidgetItem;

class MyPluginDlg;

QImage MatToQImage(cv::Mat& mat);

class qMyPlugin : public QObject, public ccStdPluginInterface
{
    Q_OBJECT
    Q_INTERFACES(ccStdPluginInterface)

public:

    //inherited from ccPluginInterface
    void getDescription(ccPluginDescription& desc);
    QIcon getIcon() const;
	void newSelection(std::vector<ccHObject*>& selectedEntities);

    //inherited from ccStdPluginInterface
    bool isEnabled(const std::vector<ccHObject*>& selectedEntities);
    int doAction(std::vector<ccHObject*>& selectedEntities,
                unsigned& uiModificationFlags,
                ccProgressDialog* progressCb=NULL,
                QWidget* parent=NULL);
    QString getErrorMessage(int errorCode/*, LANGUAGE lang*/);


	ccPointCloud* getSelectedEntityAsCCPointCloud();
	std::vector<ccPointCloud*> getSelectedEntitiesAsCCPointCloud();

public slots:

	//! Handles new entity
	void handleNewEntity(ccHObject*);

	//CityStuff
	void newCity();
	void newPoint(int i, unsigned j, int k, int l);

	void addBuilding();

	void exportGML();

	void detectPlanes();

	void singleClickBuilding(QListWidgetItem* item);
	void doubleClickBuilding(QListWidgetItem* item);
	void poulateBuildingList();


private:

	FacadeContainer* qMyPlugin::getFacade(unsigned int id);
	
	BuildingContainer* qMyPlugin::getBuilding(std::string id);

	MyPluginDlg* dlg;

	City* c;

	std::vector<BuildingContainer*> _buildingContainer;

	std::vector<ccHObject*> _selectedEntities;
};

#endif
